/*
Copyright 2022 The Numaproj Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// Code generated by Openapi Generator. DO NOT EDIT.

/// RateLimiterGoBackN : RateLimiterGoBackN is for the GoBackN mode. Releases additional tokens only when previously released tokens have been utilized above the configured threshold otherwise triggers a ramp-down. Ramp-down is also triggered when the request is made after quite a while.

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RateLimiterGoBackN {
    #[serde(rename = "coolDownPeriod", skip_serializing_if = "Option::is_none")]
    pub cool_down_period: Option<kube::core::Duration>,
    /// RampDownStrength is the strength of the ramp-down. It is a value between 0 and 1. 0 means no ramp-down and 1 means token pool is ramped down at the rate of slope=(max - min)/duration.
    #[serde(rename = "rampDownPercentage", skip_serializing_if = "Option::is_none")]
    pub ramp_down_percentage: Option<i64>,
    /// ThresholdPercentage specifies the minimum percentage of capacity, availed by the rate limiter, that should be consumed at any instance to allow the rate limiter to unlock additional capacity. For example, given the following configuration: - max = 100 - min = 10 - rampUpDuration = 10s i.e.--> slope = 10 messages/second - thresholdPercentage = 50 at t = 0, the rate limiter will release 10 messages and at least 5 of those should be consumed to unlock additional capacity of 10 messages at t = 1 to make the total capacity of 20.
    #[serde(
        rename = "thresholdPercentage",
        skip_serializing_if = "Option::is_none"
    )]
    pub threshold_percentage: Option<i64>,
}

impl RateLimiterGoBackN {
    /// RateLimiterGoBackN is for the GoBackN mode. Releases additional tokens only when previously released tokens have been utilized above the configured threshold otherwise triggers a ramp-down. Ramp-down is also triggered when the request is made after quite a while.
    pub fn new() -> RateLimiterGoBackN {
        RateLimiterGoBackN {
            cool_down_period: None,
            ramp_down_percentage: None,
            threshold_percentage: None,
        }
    }
}
